package d3_note;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class d2 {
//    @t3(value="123",aaa=99,bbb={"ffafa","fass"})
    public void test1(){
        System.out.println("test1");
    }
    @t3(value="123",aaa=99,bbb={"ffafa","fass"})
    public void test2(){
        System.out.println("test2");
    }
//    @t3(value="123",aaa=99,bbb={"ffafa","fass"})
    public void test3(){
        System.out.println("test3");
    }
    @t3(value="123",aaa=99,bbb={"ffafa","fass"})
    public void test4(){
        System.out.println("test4");
    }
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        Class c = d2.class;
        d2 d = new d2();
        Method[] methods= c.getDeclaredMethods();
        //遍历方法查看是否存在注解
        for(Method m:methods){
            if(m.isAnnotationPresent(t3.class)){//判断是否存在t3
                m.invoke(d);
            }
        }
    }
}
